import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * Created by wangyg on 2016/11/2.
 */
public class TestOffice {
	public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException,
			InstantiationException, NoSuchMethodException, InvocationTargetException {
//		Office word= new Word();
//		word.doSth();
//		Office excel= new Excel();
//		excel.doSth();
		Class<?> word = Class.forName("Word");

		Word word1=(Word)word.newInstance();
		//		word1.doSth();
		//		word1.doSth2("123");

		Method doSth = word.getDeclaredMethod("doSth2",String.class);
		doSth.invoke(word1,"123");

	}
}
